package com.hs.li.controller;

import com.hs.dto.Constants;
import com.hs.dto.ResultBean;
import com.hs.li.pojo.CarType;
import com.hs.li.service.ICarTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lhj
 * @since 2022-06-18
 */
@CrossOrigin
@RestController
@RequestMapping("/carType")
public class CarTypeController {

    @Autowired
    private ICarTypeService carTypeService;

    @GetMapping
    public ResultBean findAllCarType(){
        List<CarType> list = carTypeService.list();

        ResultBean resultBean = new ResultBean();
        resultBean.setData(list);
        resultBean.setCode(Constants.SUCCESS_CODE);
        resultBean.setMsg("查询成功！");

        return resultBean;

    }

}
